<?php

class App_Forms_UserForm extends Zend_Form
{
     public function __construct($type) 
     {
     
        //User Name
        $this->name = new Zend_Form_Element_Text('name');
        $this->name->setLabel('User Name:')
                ->setRequired(TRUE);
        
        if($type != "follower")  // new or login
        {
                       //Telephone1
                        $this->telephone1 = new Zend_Form_Element_Text('telephone1');
                        $this->telephone1->setLabel('Telephone1:')
                                ->setRequired(TRUE);
        }
        if($type != "login") //new or follower
        {
                       //Age
                        $this->age = new Zend_Form_Element_Text('age');
                        $this->age->setLabel('Age:')
                                    ->setRequired(TRUE);
        }
        if($type == "new") //new
        {
                        //Email Address
                        $email = $this->createElement('text', 'email_address');
                        $email->setLabel('Email Address:');
                        $email->setRequired(TRUE);
                        $email->addValidator(new Zend_Validate_EmailAddress());
                        $email->addFilters(array( new Zend_Filter_StringTrim(), new Zend_Filter_StringToLower()));
                        $email->setAttrib('size', 40);
                        $this->addElement($email);

                        //Telephone2
                        $this->telephone2 = new Zend_Form_Element_Text('telephone2');
                        $this->telephone2->setLabel('Telephon2:')
                                   ->setRequired(FALSE);
        }
       
       if($type != "follower")  // new or login
        {
              $this->addElement('submit','submit',array(
                'ignore'=>true,
                'label'=>'Submit'
                 )); 
       }
            
       $this->setDecorators(array(
            'FormElements',
            array('HtmlTag', array('Tag' => 'dl')),
            'Form'
        ));
    }
    
}

?>
